package com.aqielife.demo.dao;

import com.aqielife.demo.entity.Know;
import org.springframework.data.neo4j.repository.Neo4jRepository;
import org.springframework.data.neo4j.repository.query.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

/**
 * @author aqie
 * @date 2022/02/05 21:47
 * @desc
 */
@Repository
public interface KnowRepository extends Neo4jRepository<Know,Long> {

  @Query("MATCH (fromNode) WHERE id(fromNode) = {fromId} MATCH (toNode) WHERE id(toNode) = {toId} MATCH (fromNode)-[r]->(toNode) DELETE r")
  void deleteByNodeId(@Param(value = "fromId") long fromId, @Param(value = "toId") long toId);

}